<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
	</body>
</html>
<script type="text/javascript">
	const p = new Promise((resolve,reject)=>{
		setTimeout(()=>{
			resolve('用户数据');
			// reject('出错了')
		},1000)
	});
	// 回调函数中的返回的结果是非promise类型的属性，状态为成功返回值为对象成功的值
	const result = p.then(value =>{
		console.log(value);
		// return 123;
		return new Promise((resolve,reject)=>{
			// promise结果以内层为准
			// resolve('ok');
			reject('error')
		})
	},reason =>{
		console.warn(reason)
	})
	console.log(result)
	
	// 链式调用,从而避免回调地狱
	p.then(value =>{
		
	}).then(value =>{
		
	})
</script>